(when (>= emacs-major-version 24)
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/") t)
)
(require 'cl)

(defvar ckw/packages '(
company
monokai-theme
hungry-delete
smex
swiper
counsel
) "Default packages")

(defun ckw/packages-installed-p()
(loop for pkg in ckw/packages
when (not (package-installed-p pkg)) do (return nil)
finally (return t)))

(unless (ckw/packages-installed-p)
(message "%s" "Refreshing package database...")
(package-refresh-contents)
(dolist (pkg ckw/packages)
(when (not (package-installed-p pkg))
(package-install pkg))))

(load-theme 'monokai t)

(require 'hungry-delete)					;20210725
(global-hungry-delete-mode)


;hide tool bar
(tool-bar-mode -1)
;match ()
(show-paren-mode t)
;hightlight current line
(global-hl-line-mode 1)
;show  line:column status 
(column-number-mode t)
;hlight current line
(global-linum-mode t)
;20210724


;20210725
(scroll-bar-mode -1)
(electric-indent-mode -1)
(setq inhibit-splash-screen t)
(defun open-my-emacs-setting()
(interactive)
(find-file "~/.emacs.d/init.el"))
(global-set-key (kbd "<f5>") 'open-my-emacs-setting)

(global-company-mode t)

(setq-default cursor-type 'bar)

(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)

(delete-selection-mode t)

;max window
(setq initial-frame-alist (quote ((fullscreen . maximized))))




;20210726
;config for smex
(require 'smex)
(smex-initialize)
;(global-set-key (kbd "M-x") 'smex)

;config for swiper
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)













(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(custom-safe-themes
   (quote
    ("d9646b131c4aa37f01f909fbdd5a9099389518eb68f25277ed19ba99adeb7279" default)))
 '(package-selected-packages (quote (company))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
